// This file is part of AjarDSP-SoC
//
// Copyright (c) 2011 Markus Lavin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the <ORGANIZATION> nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

module vga_font(clk, rst,
                char_ascii_i,
                char_row_i,
                char_row_o);

   input clk, rst;
   input [7:0] char_ascii_i;
   input [3:0] char_row_i;
   output [7:0] char_row_o;

   wire [7:0]   char_row_rev_w;

   assign char_row_o = {char_row_rev_w[0], char_row_rev_w[1], char_row_rev_w[2], char_row_rev_w[3],
                        char_row_rev_w[4], char_row_rev_w[5], char_row_rev_w[6], char_row_rev_w[7]};

   RAMB16_S9 #(

.INIT_00(256'h0000000000000c06ff060c00000000000000000000003060ff60300000000000),
.INIT_01(256'haa55aa55aa55aa55aa55aa55aa55aa5544114411441144114411441144114411),
.INIT_02(256'h000000001b1b1b1b1b7bdbdbdb7f0000000000003c4299a5a1a1a599423c0000),
.INIT_03(256'h00000000dbdb000000000000000000000000000000000000ff00000000000000),
.INIT_04(256'h00000000ccccccccdffcffedcfcc00000000000000000000000051555bf10000),
.INIT_05(256'h00000000c07c66f3dbdbcf663e03000000000000f366666f66627c6666fc0000),
.INIT_06(256'h00000000183c7e18181818181818000000000000fce660606060f060646c3800),
.INIT_07(256'h00000000fefefefefefefefefe00000000000000181818181818187e3c180000),
.INIT_08(256'h000000000010387cfe7c3810000000000000000000000000000000386c6c3800),
.INIT_09(256'h00000000666c6c6c6c6cfe00000000000000000000fe00e0380e38e000000000),
.INIT_0A(256'h0000000000000000f8181818181818180000000000fe000e38e0380e00000000),
.INIT_0B(256'h1818181818181818f81818181818181800000000007e0018187e181800000000),
.INIT_0C(256'h181818181818181818181818181818181818181818181818f800000000000000),
.INIT_0D(256'h0000000018183c66606060663c18180000000000183c3c3c1818180018180000),
.INIT_0E(256'h000000001818187e187e183c666600000000000000663c6666663c6600000000),
.INIT_0F(256'h0000007cc60c386cc6c66c3860c67c0000000000181818181800181818180000),
.INIT_10(256'h000000001818001818183c3c3c18000000000000000000000000000000000000),
.INIT_11(256'h000000006c6cfe6c6c6cfe6c6c00000000000000000000000000002466666600),
.INIT_12(256'h0000000086c66030180cc6c200000000000018187cc68606067cc0c2c67c1818),
.INIT_13(256'h000000000000000000000020303030000000000076ccccccdc76386c6c380000),
.INIT_14(256'h0000000030180c0c0c0c0c0c18300000000000000c18303030303030180c0000),
.INIT_15(256'h00000000000018187e18180000000000000000000000663cff3c660000000000),
.INIT_16(256'h0000000000000000fe0000000000000000000030181818000000000000000000),
.INIT_17(256'h0000000080c06030180c06020000000000000000181800000000000000000000),
.INIT_18(256'h000000007e181818181818783818000000000000386cc6c6d6d6c6c66c380000),
.INIT_19(256'h000000007cc60606063c0606c67c000000000000fec6c06030180c06c67c0000),
.INIT_1A(256'h000000007cc6060606fcc0c0c0fe0000000000001e0c0c0cfecc6c3c1c0c0000),
.INIT_1B(256'h0000000030303030180c0606c6fe0000000000007cc6c6c6c6fcc0c060380000),
.INIT_1C(256'h00000000780c0606067ec6c6c67c0000000000007cc6c6c6c67cc6c6c67c0000),
.INIT_1D(256'h0000000030181800000018180000000000000000001818000000181800000000),
.INIT_1E(256'h000000000000007e00007e000000000000000000060c18306030180c06000000),
.INIT_1F(256'h000000001818001818180cc6c67c0000000000006030180c060c183060000000),
.INIT_20(256'h00000000c6c6c6c6fec6c66c38100000000000007cc0dcdededec6c67c000000),
.INIT_21(256'h000000003c66c2c0c0c0c0c2663c000000000000fc666666667c666666fc0000),
.INIT_22(256'h00000000fe6662606878686266fe000000000000f86c6666666666666cf80000),
.INIT_23(256'h000000003a66c6c6dec0c0c2663c000000000000f06060606878686266fe0000),
.INIT_24(256'h000000003c18181818181818183c000000000000c6c6c6c6c6fec6c6c6c60000),
.INIT_25(256'h00000000e666666c78786c6666e600000000000078cccccc0c0c0c0c0c1e0000),
.INIT_26(256'h00000000c6c6c6c6c6d6fefeeec6000000000000fe6662606060606060f00000),
.INIT_27(256'h000000007cc6c6c6c6c6c6c6c67c000000000000c6c6c6c6cedefef6e6c60000),
.INIT_28(256'h00000e0c7cded6c6c6c6c6c6c67c000000000000f0606060607c666666fc0000),
.INIT_29(256'h000000007cc6c6060c3860c6c67c000000000000e66666666c7c666666fc0000),
.INIT_2A(256'h000000007cc6c6c6c6c6c6c6c6c60000000000003c1818181818185a7e7e0000),
.INIT_2B(256'h000000006ceefed6d6d6c6c6c6c600000000000010386cc6c6c6c6c6c6c60000),
.INIT_2C(256'h000000003c181818183c66666666000000000000c6c66c7c38387c6cc6c60000),
.INIT_2D(256'h000000003c30303030303030303c000000000000fec6c26030180c86c6fe0000),
.INIT_2E(256'h000000003c0c0c0c0c0c0c0c0c3c00000000000002060e1c3870e0c080000000),
.INIT_2F(256'h0000ff00000000000000000000000000000000000000000000000000c66c3810),
.INIT_30(256'h0000000076cccccc7c0c78000000000000000000000000000000000000183030),
.INIT_31(256'h000000007cc6c0c0c0c67c0000000000000000007c666666666c786060e00000),
.INIT_32(256'h000000007cc6c0c0fec67c00000000000000000076cccccccc6c3c0c0c1c0000),
.INIT_33(256'h0078cc0c7ccccccccccc76000000000000000000f060606060f060646c380000),
.INIT_34(256'h000000003c181818181838001818000000000000e666666666766c6060e00000),
.INIT_35(256'h00000000e6666c78786c666060e00000003c66660606060606060e0006060000),
.INIT_36(256'h00000000c6d6d6d6d6feec0000000000000000003c1818181818181818380000),
.INIT_37(256'h000000007cc6c6c6c6c67c000000000000000000666666666666dc0000000000),
.INIT_38(256'h001e0c0c7ccccccccccc76000000000000f060607c6666666666dc0000000000),
.INIT_39(256'h000000007cc60c3860c67c000000000000000000f06060606676dc0000000000),
.INIT_3A(256'h0000000076cccccccccccc0000000000000000001c3630303030fc3030100000),
.INIT_3B(256'h000000006cfed6d6d6c6c6000000000000000000183c66666666660000000000),
.INIT_3C(256'h00f80c067ec6c6c6c6c6c6000000000000000000c66c3838386cc60000000000),
.INIT_3D(256'h000000000e18181818701818180e000000000000fec6603018ccfe0000000000),
.INIT_3E(256'h0000000070181818180e18181870000000000000181818181800181818180000),
.INIT_3F(256'h0000000000000000000000006c6c0000000000000000000000000000dc760000)

               )font_ram(.DO(char_row_rev_w),
                         .DOP(),
                         .ADDR({char_ascii_i, char_row_i}),
                         .CLK(clk),
                         .DI(0),
                         .DIP(0),
                         .EN(1),
                         .SSR(rst),
                         .WE(0));

endmodule
